package com.hxd.otc.module.my.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hxd.otc.R;
import com.hxd.otc.module.my.bean.ExchangeRecordBean;
import com.hxd.otc.utils.StringUtil;
import com.hxd.otc.utils.UIUtils;

/**
 * 包  名 :  com.hxd.otc.module.order.adapter
 * 类  名 :  OllOrderAdapter
 * 作  者 :  zjl
 * 时  间 :  2018/6/5 18:03
 * 描  述 :  ${全部订单页面}
 */
public class ExchangeRecordAdapter extends BaseQuickAdapter<ExchangeRecordBean, BaseViewHolder> {

    private String[] statusType;

    public ExchangeRecordAdapter() {
        super(R.layout.adapter_exchange_recoder, null);
        statusType = UIUtils.getContext().getResources().getStringArray(R.array.exchange_order_statues);
    }

    @Override
    protected void convert(BaseViewHolder helper, final ExchangeRecordBean item) {

        helper.setText(R.id.tv_order_number, UIUtils.getContext().getString(R.string.exchange_order_number, item.getId()));
        helper.setText(R.id.tv_time, item.getCreateDate());
        helper.setText(R.id.tv_swap_out, UIUtils.getContext().getString(R.string.swap_out, StringUtil.format8Number(item.getOutVolume()), item.getOutSymbol()));
        helper.setText(R.id.tv_swap_in, UIUtils.getContext().getString(R.string.swap_in, StringUtil.format8Number(item.getInVolume()), item.getInSymbol()));
        helper.setText(R.id.tv_fee, UIUtils.getContext().getString(R.string.exchange_recoder_fee, StringUtil.format8Number(item.getFee()), item.getInSymbol()));

        switch (item.getStatus()) {
            case 0:
                helper.setText(R.id.tv_statues, statusType[0]);
                break;
            case 1:
                helper.setText(R.id.tv_statues, statusType[1]);
                break;
            case 2:
                helper.setText(R.id.tv_statues, statusType[2]);
                break;
            case 3:
                helper.setText(R.id.tv_statues, statusType[3]);
                break;
        }

    }

}
